import React from 'react';
import { AxCreateForm } from '@/components/AxForm/AxCreateForm';
import { AxStandardWideList } from '@/components/AxList/AxStandardWideList';
import { axconst } from '@/shared/axconst';
import { AxColumnEnum } from '@/components/AxList';

const url = {
    read: '/api/orderGoods/read',
};
const Detail: React.FC<any> = props => {
    const { values } = props;

    /** 配置列 */
    const columns: any[] = [
        {
            title: '订单编号',
            dataIndex: 'orderNo',
            width: axconst.width.longx,
        },
        {
            title: '收货人',
            dataIndex: 'receiver',
            width: axconst.width.three,
        },
        {
            title: '联系电话',
            dataIndex: 'mobile',
            width: axconst.width.eight,
        },
        {
            title: '商品名称',
            dataIndex: 'name',
            width: axconst.width.orderTitle,
        },
        {
            title: '数量',
            dataIndex: 'amount',
            width: axconst.width.fouronly,
        },
        {
            title: '订单总额',
            dataIndex: 'price',
            width: axconst.width.four,
        },
        {
            title: '状态',
            dataIndex: 'state',
            width: axconst.width.four,
            render: (val: any) => AxColumnEnum({ enumName: 'status', value: val }),
        }
    ];

    return (
        <AxCreateForm
            {...props}
            title="订单详情"
            footer={null}
            width='50%'
        >
            <AxStandardWideList
                url={url}
                size="default"
                params={{ orderNo: values.orderNo }}
                bodyStyle={{ padding: 0 }}
                columns={columns}
                checkboxModel={false}
                showTopSlider={false}
                showSimpleSearch={false}
                showRefresh={false}
            />
        </AxCreateForm>
    );
};

export default Detail;
